package com.tjetc.hw;

public class 买卖股票 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
        int max=0;//最大利润
        int p=Integer.MAX_VALUE;//最小值
        for (int i : arr) {
            max=Math.max(max,i-p);
            p=Math.min(p,i);
        }
        System.out.println(max);

    }
}
